import { getAllUserApplication } from '@/api/userApplication'

export default {
  namespaced: true,
  state: {
    userApplication: [],
    pageUserApplication: [],
    loading: false,
    total: 0
  },
  actions: {
    getAllUserApplication ({ commit }, payload) {
      commit('getAllUserApplication', payload)
    }
  },
  mutations: {
    getAllUserApplication (state, payload) {
      state.loading = true
      getAllUserApplication(payload).then(res => {
        console.log('getAllUserApplication: ', res)
        state.loading = false
        state.userApplication = res.userApplication
      }).catch(err => {
        console.log('err', err)
        state.loading = false
      })
    }
  },
  getters: {
    userApplication: (state) => { return state.userApplication },
    loading: (state) => { return state.loading },
    total: (state) => { return state.total }
  }
}
